//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.aidong.dao.wills;

import com.aidong.dao.base.OrderSet;
import com.aidong.dao.wills.BaseDao;
import com.aidong.model.wills.KyTimeTable;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import org.springframework.stereotype.Repository;

@Repository
public class KyTimeTableDao extends BaseDao<KyTimeTable, Integer> {
    public KyTimeTableDao() {
    }

    public List<KyTimeTable> getListByShopDay(String shopCode, Date date1, Date date2) {
        String sqlww = "shopCode=:p1 and classTime>=:p2 and classTime<:p3 and status>0";
        return this.queryList(sqlww, new Object[]{shopCode, date1, date2}, (new OrderSet()).asc("classTime"), -1);
    }

    public int addTimeTable(List<KyTimeTable> list) {
        Iterator i$ = list.iterator();

        while(i$.hasNext()) {
            KyTimeTable table = (KyTimeTable)i$.next();
            this.add(table);
        }

        return list.size();
    }

    public boolean updateStatus(int id, int status) {
        String hql = "update KyTimeTable set status=:p1 where id=:p2";
        return this.updateByHql(hql, new Object[]{Integer.valueOf(status), Integer.valueOf(id)}) > 0;
    }

    public void updateTimeTable(KyTimeTable table) {
        this.update(table);
        String sql = "update KyBespeak set ptCode=:p1, coachCode=:p2, classTime=:p3 where classType=\'2\' and classId=:p4";
        this.updateBySql(sql, new Object[]{table.getPtCode(), table.getCoachCode(), table.getClassTime(), table.getClassId()});
    }
}
